package com.ldk.base.framework.datasource.generator;

import java.sql.Types;

/**
 * 数据库表字段类型
 * @author xiangwl
 *
 */
public enum TableColumnDataType {
	
	  BIT("BIT","java.lang.Boolean", Types.BIT),
	  TINYINT("TINYINT", "java.lang.Boolean", Types.TINYINT),//特殊处理TINYINT都是boolean
	  SMALLINT("SMALLINT","java.lang.Integer", Types.SMALLINT),
	  INTEGER("INT","java.lang.Long", Types.INTEGER),
	  BIGINT("BIGINT","java.lang.Long", Types.BIGINT),
	  FLOAT("FLOAT","java.lang.Double",Types.FLOAT),
	  REAL("REAL","java.lang.Float",Types.REAL),
	  DOUBLE("DOUBLE","java.lang.Double",Types.DOUBLE),
	  NUMERIC("NUMERIC","java.lang.Double",Types.NUMERIC),
	  DECIMAL("DECIMAL","java.lang.Double", Types.DECIMAL),
	  CHAR("CHAR","java.lang.String",Types.CHAR),
	  VARCHAR("VARCHAR","java.lang.String",Types.VARCHAR),
	  VARCHAR2("VARCHAR2","java.lang.String",Types.VARCHAR),//oracle
	  LONGVARCHAR("LONGVARCHAR","java.lang.String",Types.LONGVARCHAR),
	  DATE("DATE","java.sql.Date",Types.DATE),
	  TIME("TIME","	java.sql.Time",Types.TIME),
	  TIMESTAMP("TIMESTAMP","java.sql.Timestamp",Types.TIMESTAMP),
	  BINARY("BINARY","byte[]",Types.BINARY),
	  VARBINARY("VARBINARY","byte[]",Types.VARBINARY),
	  LONGVARBINARY("LONGVARBINARY","byte[]",Types.LONGVARBINARY),
	  NULL("NULL","java.lang.Object",Types.NULL),
	  OTHER("OTHER","java.lang.Object",Types.OTHER),
	  BLOB("BLOB","byte[]",Types.BLOB),
	  CLOB("CLOB","java.lang.String",Types.CLOB),
	  BOOLEAN("BOOLEAN","java.lang.Boolean", Types.BOOLEAN),
	  NVARCHAR("NVARCHAR","java.lang.String",Types.NVARCHAR), // JDK6
	  NVARCHAR2("NVARCHAR2","java.lang.String",Types.NVARCHAR), // oracle
	  NCHAR("NCHAR","java.lang.String",Types.NCHAR), // JDK6
	  NCLOB("NCLOB","java.lang.String",Types.NCLOB), // JDK6
	  JSON("JSON","java.lang.String",-9998),//PG
	  TEXT("TEXT","java.lang.String",-9999),
	;
	  
	private TableColumnDataType(String sqlType, String javaType, int code){
		this.sqlType = sqlType;
		this.javaType = javaType;
		this.code = code;
	}
	
	private String sqlType;
	private String javaType;
	private int    code;
	
	public String getSqlType() {
		return sqlType;
	}
	public String getJavaType() {
		return javaType;
	}
	public int getCode() {
		return code;
	}
}
